/**
 * Company : Thai Informatic System Co., Ltd.
 * Created By : Chatree Siangklom
 * Created On : Jan 14, 2013  1:45:14 PM 
 * e-Mail : dr_chatree@hotmail.com
 * Mobile Phone : (+66) 087-921-5115
 * Package Name : apps.business.process
 * File Name : SyncProcessorCommons.java
 * TODO
 */
package apps.business.process;

import java.sql.Connection;
import apps.promis.out.common.SyncQueueAction;
import jpa.entitys.synchro.staging.SyncQueue;

/**
 * @author chatree
 *
 */
public class SyncProcessorCommons {
	
	private SyncQueue queue;
	private Connection conn;
	/**
	 * @return the queue
	 */
	public synchronized SyncQueue getQueue() {
		return queue;
	}
	/**
	 * @param queue the queue to set
	 */
	public synchronized void setQueue(SyncQueue queue) {
		this.queue = queue;
	}
	/**
	 * @return the conn
	 */
	public synchronized Connection getConn() {
		return conn;
	}
	/**
	 * @param conn the conn to set
	 */
	public synchronized void setConn(Connection conn) {
		this.conn = conn;
	}
	
	protected void UPD_PROMISUseTime(boolean isStartTime, boolean isStopTime, String instanceNo) throws Exception  {
		try {
			
			if(queue != null && conn != null)
				new SyncQueueAction().UPD_PROMISUseTime(queue.getQueueId(), conn, isStartTime, isStopTime, null, instanceNo);
			else
				System.out.println("Queue is null and Connection is null !!!!");
			
		} catch (Exception e) {
			e.printStackTrace();			
			throw e;
		}
	}

	protected void UPD_SENDUseTime(boolean isStartTime, boolean isStopTime, String instanceNo) throws Exception  {
		try {
			if(queue != null && conn != null)
				new SyncQueueAction().UPD_SENDUseTime(queue.getQueueId(), conn, isStartTime, isStopTime, null, instanceNo);
			else
				System.out.println("Queue is null and Connection is null !!!!");
		} catch (Exception e) {
			e.printStackTrace();			
			throw e;
		}
	}

}
